%--------------------------------------------------------------------------
% makes figure three in the paper
%
% make sure to change the c0 in comp_A to use the first eigenfunction
%
%-------------------------------------------------------------------------

function fig3(k0)

close all

addpath ../
addpath ../leading_order/

p = params;

% plot the neutral stab curves

subplot(1,2,1);

kk = linspace(0, 3, 100);
[kk, M] = lo_neutral_stab_curves(kk, 0);

plot(kk, M, 'k', 'linewidth',1);

h = linspace(1, 1-p.beta, 100);
k = k0 * h;
M = (h - 1 + p.beta) / p.beta * p.Ma_prime;

hold on;
plot(k(1), M(1), 'k*');
plot(k, M, 'k--');

ylim([60, 130]);

xlabel('$\check{k}$', 'interpreter','latex','fontsize',12);
ylabel('$\mathcal{M}$','interpreter','latex','fontsize',12);

% plot the amplitudes
subplot(1,2,2);
[k_c, M_c] = comp_A(k0);

subplot(1,2,1);
hold on;
plot(k_c, M_c, 'k.', 'markersize',12);